import Vue from 'vue'
import App from './App.vue'
import router from './router'
import VueQuillEditor from 'vue-quill-editor'
// import 'quill/dist/quill.core.css'
// import 'quill/dist/quill.snow.css'
// import 'quill/dist/quill.bubble.css'
// eslint-disable-next-line no-unused-vars
import ElementUI from 'element-ui'
// import 'element-ui/lib/theme-chalk/index.css'
import '@/assets/css/global.css'
import '@/assets/fonts/iconfont.css'
import Treetable from 'vue-table-with-tree-grid'
import NProgress from 'nprogress'
// import 'nprogress/nprogress.css'
import Axios from 'axios'

// 使用cdn外联element-ui库文件时不需要调用use将element-ui挂载到vue实例
// Vue.use(ElementUI)
Vue.config.productionTip = false
Vue.filter('dateFormat', function (originDate) {
  // 声明一个date对象
  const msDate = new Date(originDate)
  // 调用date对象的方法获取年月日时分秒
  const y = msDate.getFullYear()
  // 月份加一
  const m = (msDate.getMonth() + 1).toString().padStart(2, '')
  const d = (msDate.getDate()).toString().padStart(2, '')
  // 时分秒转字符串并使用padStart补齐两位：
  // padStart参数一：补齐成多少位，参数二：用什么字符补齐
  const hh = msDate.getHours().toString().padStart(2, '0')
  const mm = msDate.getMinutes().toString().padStart(2, '0')
  const ss = msDate.getSeconds().toString().padStart(2, '0')
  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`
})
Vue.component('tree-table', Treetable)
Vue.use(VueQuillEditor /* { default global options } */)
// 设置request拦截器
Axios.interceptors.request.use(config => {
  NProgress.start()
  return config
})
// 设置respinse拦截器
Axios.interceptors.response.use(config => {
  NProgress.done()
  return config
})
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
